Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclusively build for pwdata and filter out modules #3

Merged
merged 38 commits into from
May 1, 2024

Conversation

jacksongoode
Copy link
Collaborator

@jacksongoode jacksongoode commented Apr 23, 2024

This way we can pass in ["pwdata"] as a exclusive package to filter by and then skip all the Pipeline classes as ignored_mods.

@jacksongoode jacksongoode force-pushed the jackson/filter-modules branch 4 times, most recently from 1dd5e54 to eaf8005 Compare April 23, 2024 05:29
Copy link
Member

@adkinsjd adkinsjd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small comments. I just want to make sure I understand what's happening here.

if src_name.split(".")[0] not in self.exclusives:
continue

# Skip ignored modules
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to skip ignored modules down here and remove them from times above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Below is what happens when PyCG looks at an import declaration, the other ... in self.ignored_mods: case above is when we visit a module. I did this as a safety precaution more so I think PyCG could end up traversing through a ignored modules in both cases - though I could be wrong about this and we can test.

@@ -205,6 +215,14 @@ def add_external_def(name, target):
tgt_name = import_item.asname if import_item.asname else import_item.name
imported_name = self.import_manager.handle_import(src_name, level)

# Limit to exclusive module
if src_name.split(".")[0] not in self.exclusives:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens here if self.exclusives is None?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I'll add their default to be an empty array.

@jacksongoode jacksongoode merged commit b21c0ea into main May 1, 2024
2 of 4 checks passed
@jacksongoode jacksongoode deleted the jackson/filter-modules branch May 1, 2024 06:04
adkinsjd added a commit that referenced this pull request May 2, 2024
@jacksongoode jacksongoode restored the jackson/filter-modules branch May 2, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants